package top.healthylife.gateway.platform.br.api.api.creditrisk;


import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.br.api.utils.GetmeltingTokenUtils;
import top.healthylife.gateway.platform.br.dto.creditrisk.scorerevoloan.req.BrReqScoreRevoLoanDto;
import top.healthylife.gateway.platform.br.dto.creditrisk.scorerevoloan.res.BrResScoreRevoLoanDto;

/**
 * @author cl
 * @version 1.0
 * @date 2020/4/23 11:03
 */
@Slf4j
@Service
@ApiServiceExplain( docUrl="https://account-self.100credit.com/", price = 20,apiName = "信用风险识别-信用卡(类信用卡)", info = "适用申请银行信用卡（类信用卡）的客群风险识别")
public class ScoreRevoLoanApi implements ParentFace<BrReqScoreRevoLoanDto, BrResScoreRevoLoanDto> {
    /**
     * 接口唯一标识
     */
    static final String APIIDENTIFICATION = "scorerevoloan";

    /**
     * 接口版本号
     */
    static final String VESION = "4.0";

    @Override
    public BrResScoreRevoLoanDto execute(BrReqScoreRevoLoanDto brDemoApi){
        //访问百融获取数据
        String apiData = GetmeltingTokenUtils.getApiData(APIIDENTIFICATION, VESION
                , BeanUtil.beanToMap(brDemoApi), GetmeltingTokenUtils.systemConfigInfo(brDemoApi));
        return JSON.parseObject(apiData, BrResScoreRevoLoanDto.class);
    }
}
